/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2024-07-09
 * Time: 13:26
 */
/**
 * Forward declaration of guess API.
 * @param  num   your guess
 * @return 	     -1 if num is higher than the picked number
 *			      1 if num is lower than the picked number
 *               otherwise return 0
 * int guess(int num);
 */

public class Solution27  {
    public int guessNumber(int n) {
        int left = 1,rigth = n;


        while(left < rigth) {
            int mid = left + (rigth-left) / 2;
            //猜的数字大
            if(guess(mid) <= 0) {
                rigth = mid;
            }else {
                left = mid+1;
            }
        }
        return left;
    }
    int guess(int mid) {
        return -1;
    }

}
